package com.lleice.service.test;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

import cn.hutool.core.util.StrUtil;
import freemarker.core.ParseException;
import freemarker.template.Configuration;
import freemarker.template.MalformedTemplateNameException;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import freemarker.template.TemplateNotFoundException;

/**
 * 修改包路径生成代码
 * @author lizihao
 *
 */
public class PackageGenerator {
	
    public static void main(String[] args) throws IOException {
    	//生成项目目录
    	String projectPath = "/Users/lleice/Desktop/test-generator";
    	//主项目名称(原base-framework)
    	String mainProjectName = "lleice-framework";
    	//父依赖名称(原base-framework-single-parent
    	String parentProjectName = "lleice-parent";
    	//通用依赖名称(原base-framework-common)
    	String commonProjectName = "lleice-common";
    	//web端名称(原base-framework-web)
    	String webProjectName = "lleice-web";
    	//dao层名称(原base-framework-web-service)
    	String serviceProjectName = "lleice-service";
    	
    	//groupId & artifactId
    	String groupId = "com.lleice";
    	//若不填则默认与projectName一致
    	String parentArtifactId = "";
    	String commonArtifactId = "";
    	String webArtifactId = "";
    	String serviceArtifactId = "";
    	
    	//包名
    	//替换原com.chinaunicom.framework.web.bussiness包名
    	String servicePackageName = "com.lleice.service";
    	//替换原com.chinaunicom.framework.web包名
    	String webPackageName = "com.lleice.web";
    	//替换原com.chinaunicom.framework.common包名
    	String commonPackageName = "com.lleice.common";
    	//替换原com.chinaunicom.framework扫描路径
    	String webApplicationPackageName = "com.lleice";
    	
    	 Map<String, Object> params = new HashMap<String,Object>(16);
         params.put("groupId", groupId);
         params.put("parentArtifactId", StrUtil.isBlank(parentArtifactId)?parentProjectName:parentArtifactId);
         params.put("commonArtifactId", StrUtil.isBlank(commonArtifactId)?commonProjectName:commonArtifactId);
         params.put("webArtifactId", StrUtil.isBlank(webArtifactId)?webProjectName:webArtifactId);
         params.put("serviceArtifactId", StrUtil.isBlank(serviceArtifactId)?serviceProjectName:serviceArtifactId);
         
         //创建maven结构项目
    	genMavenProject(projectPath, mainProjectName, parentProjectName, commonProjectName, webProjectName,
				serviceProjectName, params);
    	//创建代码
    	generatorCode(projectPath, mainProjectName, commonProjectName, webProjectName, serviceProjectName, servicePackageName, webPackageName, commonPackageName, webApplicationPackageName);
    	System.out.println("新项目已经在"+projectPath+"生成了");
	}

    public static void generatorCode(String projectPath,String mainProjectName,String commonProjectName,String webProjectName,String serviceProjectName,
    		String servicePackageName,String webPackageName,String commonPackageName,String webApplicationPackageName) throws IOException {
        Configuration configuration = new Configuration(Configuration.VERSION_2_3_23);
        configuration.setClassForTemplateLoading(PackageGenerator.class, "/templates");
       
        // 获取文件路径
        Map<String, Object> params = new HashMap<String,Object>(16);
        params.put("servicePackageName", servicePackageName);
        params.put("commonPackageName", commonPackageName);
        params.put("webPackageName", webPackageName);
        params.put("webApplicationPackageName", webApplicationPackageName);
        params.put("typeAliasesPackage", servicePackageName.replace(".", "/"));
        //common项目
        genCommon(projectPath, mainProjectName, commonProjectName, commonPackageName, configuration, params);
        //service项目
        genService(projectPath, mainProjectName, serviceProjectName, servicePackageName, configuration, params);
        //web端
        genWeb(projectPath, mainProjectName, webProjectName, serviceProjectName, webPackageName, configuration, params);
    }

	private static void genWeb(String projectPath, String mainProjectName, String webProjectName,
			String serviceProjectName, String webPackageName, Configuration configuration, Map<String, Object> params) {
		Map<String,String> webMap = getWebList();
        webMap.forEach((k,v) ->{
        	try {
				Template template = configuration.getTemplate(k);
				File file = new File(projectPath+File.separator+mainProjectName+File.separator+webProjectName+File.separator+"src/main/java/"+webPackageName.replace(".", "/")+v);
                // 生成代码
                genFile(file, template, params);
			} catch (IOException e) {
				e.printStackTrace();
			}
        });
        //创建web-test文件夹代码
        Map<String,String> serviceTestMap = getWebTestList();
        serviceTestMap.forEach((k,v) ->{
        	try {
				Template template = configuration.getTemplate(k);
				File serviceTestFile = new File(projectPath+File.separator+mainProjectName+File.separator+webProjectName+File.separator+"src/test/java/"+(webPackageName+".test").replace(".", "/")+v);
				genFile(serviceTestFile, template, params);
        	} catch (IOException e) {
				e.printStackTrace();
			}
        });
        //创建web-resources配置文件代码
        Map<String,String> xmlMap = getConfigList();
        xmlMap.forEach((k,v) ->{
        	try {
				Template template = configuration.getTemplate(k);
				File file = new File(projectPath+File.separator+mainProjectName+File.separator+webProjectName+File.separator+"src/main/resources"+v);
                // 生成代码
                genFile(file, template, params);
			} catch (IOException e) {
				e.printStackTrace();
			}
        });
	}

	private static void genService(String projectPath, String mainProjectName, String serviceProjectName,
			String servicePackageName, Configuration configuration, Map<String, Object> params) {
		Map<String,String> serviceJavaMap = getJavaList();
        //创建文件夹
        serviceJavaMap.forEach((k,v) ->{
        	try {
				Template template = configuration.getTemplate(k);
				File file = new File(projectPath+File.separator+mainProjectName+File.separator+serviceProjectName+File.separator+"src/main/java/"+servicePackageName.replace(".", "/")+v);
                // 生成代码
                genFile(file, template, params);
			} catch (IOException e) {
				e.printStackTrace();
			}
        });
        //创建service-test文件夹代码
        Map<String,String> serviceTestMap = getServiceTestList();
        serviceTestMap.forEach((k,v) ->{
        	try {
				Template template = configuration.getTemplate(k);
				File serviceTestFile = new File(projectPath+File.separator+mainProjectName+File.separator+serviceProjectName+File.separator+"src/test/java/"+(servicePackageName+".test").replace(".", "/")+v);
				genFile(serviceTestFile, template, params);
        	} catch (IOException e) {
				e.printStackTrace();
			}
        });
  
        //service-xml
        Map<String,String> xmlMap = getXmlList();
        xmlMap.forEach((k,v) ->{
        	try {
				Template template = configuration.getTemplate(k);
				File file = new File(projectPath+File.separator+mainProjectName+File.separator+serviceProjectName+File.separator+"src/main/resources/mapper"+v);
                // 生成代码
                genFile(file, template, params);
			} catch (IOException e) {
				e.printStackTrace();
			}
        });
        //service-templates
        try {
			Template templates = configuration.getTemplate("service/ftl/mapper.ftl");
			File templateFile = new File(projectPath+File.separator+mainProjectName+File.separator+serviceProjectName+File.separator+"src/main/resources/templates"+"/mapper.java.ftl");
            // 生成代码
            genFile(templateFile, templates, params);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	private static void genCommon(String projectPath, String mainProjectName, String commonProjectName,
			String commonPackageName, Configuration configuration, Map<String, Object> params) {
		Map<String,String> commonMap = getCommonList();
        commonMap.forEach((k,v) ->{
        	try {
				Template template = configuration.getTemplate(k);
				File file = new File(projectPath+File.separator+mainProjectName+File.separator+commonProjectName+File.separator+"src/main/java/"+commonPackageName.replace(".", "/")+v);
                //创建java代码
                genFile(file, template, params);
			} catch (IOException e) {
				e.printStackTrace();
			}
        });
        //创建test文件夹代码
        File commonTestFile = new File(projectPath+File.separator+mainProjectName+File.separator+commonProjectName+File.separator+"src/test/java");
        if(!commonTestFile.exists()){
        	commonTestFile.mkdir();
        }
	}
    
    private static void genMavenProject(String projectPath, String mainProjectName, String parentProjectName,
			String commonProjectName, String webProjectName, String serviceProjectName, Map<String, Object> params)
			throws TemplateNotFoundException, MalformedTemplateNameException, ParseException, IOException {
		File file=new File(projectPath+File.separator+mainProjectName);
		if(!file.exists()){
			file.mkdir();
			file = new File(projectPath+File.separator+mainProjectName+File.separator+parentProjectName);
			if(!file.exists()){
				file.mkdir();
				//创建parent.pom
				genPom("pom/parentPom.ftl", projectPath+File.separator+mainProjectName+File.separator+parentProjectName+File.separator+"pom.xml", params);
				file = new File(projectPath+File.separator+mainProjectName+File.separator+commonProjectName);
				if(!file.exists()){
					file.mkdir();
					//创建common.pom
					genPom("pom/commonPom.ftl", projectPath+File.separator+mainProjectName+File.separator+commonProjectName+File.separator+"pom.xml", params);
					file = new File(projectPath+File.separator+mainProjectName+File.separator+webProjectName);
					if(!file.exists()){
						file.mkdir();
						//创建web.pom
						genPom("pom/webPom.ftl", projectPath+File.separator+mainProjectName+File.separator+webProjectName+File.separator+"pom.xml", params);
						file = new File(projectPath+File.separator+mainProjectName+File.separator+serviceProjectName);
						if(!file.exists()){
							file.mkdir();
							//创建service.pom
							genPom("pom/servicePom.ftl", projectPath+File.separator+mainProjectName+File.separator+serviceProjectName+File.separator+"pom.xml", params);
						}
					}
				}
			}
		}
	}

    private static void genPom(String ftlPath,String filePath,Map<String, Object> params) throws TemplateNotFoundException, MalformedTemplateNameException, ParseException, IOException {
    	Configuration configuration = new Configuration(Configuration.VERSION_2_3_23);
        configuration.setClassForTemplateLoading(PackageGenerator.class, "/templates");
    	Template template = configuration.getTemplate(ftlPath);
		File file = new File(filePath);
        // 生成代码
        genFile(file, template, params);
    }
    
	private static void genFile(File file, Template template, Map<String, Object> params) throws IOException {
        File parentFile = file.getParentFile();
        // 创建目录
        if (null != parentFile && !parentFile.exists()) {
            parentFile.mkdirs();
        }
        //创建输出流
        Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
        //输出模板和数据模型都对应的文件
        try {
            template.process(params, writer);
        } catch (TemplateException e) {
            e.printStackTrace();
        }
    }
	
	private static Map<String,String> getServiceTestList() {
		Map<String,String> map = new LinkedHashMap<String,String>();
		//test
		map.put("service/test/DbDocumentGenerator.ftl", "/DbDocumentGenerator.java");
		map.put("service/test/MybatisGenerator.ftl", "/MybatisGenerator.java");
		return map;
	}
	
	private static Map<String,String> getWebTestList() {
		Map<String,String> map = new LinkedHashMap<String,String>();
		//test
		map.put("web/test/DataSourceEnc.ftl", "/DataSourceEnc.java");
		map.put("web/test/JacksonDemo.ftl", "/JacksonDemo.java");
		map.put("web/test/SysDepartmentControllerTest.ftl", "/SysDepartmentControllerTest.java");
		map.put("web/test/SysResourceControllerTest.ftl", "/SysResourceControllerTest.java");
		map.put("web/test/SysRoleControllerTest.ftl", "/SysRoleControllerTest.java");
		map.put("web/test/SysUserControllerTest.ftl", "/SysUserControllerTest.java");
		map.put("web/test/TestFoo.ftl", "/TestFoo.java");
		return map;
	}
	
	private static Map<String,String> getJavaList() {
		Map<String,String> map = new LinkedHashMap<String,String>();
		//vo
		map.put("service/vo/sys/UserListPageVo.ftl", "/vo/sys/UserListPageVo.java");
		map.put("service/vo/other/ExportVo.ftl", "/vo/other/ExportVo.java");
		//qo.sys
		map.put("service/qo/sys/DepartmentReq.ftl", "/qo/sys/DepartmentReq.java");
		map.put("service/qo/sys/DepatmentListPageReq.ftl", "/qo/sys/DepatmentListPageReq.java");
		map.put("service/qo/sys/LoginReq.ftl", "/qo/sys/LoginReq.java");
		map.put("service/qo/sys/RequestLogListPageReq.ftl", "/qo/sys/RequestLogListPageReq.java");
		map.put("service/qo/sys/ResoucesAuthorizationReq.ftl", "/qo/sys/ResoucesAuthorizationReq.java");
		map.put("service/qo/sys/ResourceListPageReq.ftl", "/qo/sys/ResourceListPageReq.java");
		map.put("service/qo/sys/ResourceReq.ftl", "/qo/sys/ResourceReq.java");
		map.put("service/qo/sys/RoleListPageReq.ftl", "/qo/sys/RoleListPageReq.java");
		map.put("service/qo/sys/RoleReq.ftl", "/qo/sys/RoleReq.java");
		map.put("service/qo/sys/UserListPageReq.ftl", "/qo/sys/UserListPageReq.java");
		map.put("service/qo/sys/UserReq.ftl", "/qo/sys/UserReq.java");
		//qo.other
		map.put("service/qo/other/BatchDeleteQo.ftl", "/qo/other/BatchDeleteQo.java");
		//qo.business
		map.put("service/qo/business/DataScopeTestQo.ftl", "/qo/business/DataScopeTestQo.java");
		//mapstruct
		map.put("service/mapstruct/DepartmentConverMapper.ftl", "/mapstruct/DepartmentConverMapper.java");
		map.put("service/mapstruct/SysResourceConverMapper.ftl", "/mapstruct/SysResourceConverMapper.java");
		map.put("service/mapstruct/SysUserConverMapper.ftl", "/mapstruct/SysUserConverMapper.java");
		//dto
		map.put("service/dto/DepartmentTreeDto.ftl", "/dto/DepartmentTreeDto.java");
		map.put("service/dto/DepartmentTreeParentDto.ftl", "/dto/DepartmentTreeParentDto.java");
		map.put("service/dto/ResouceTreeDto.ftl", "/dto/ResouceTreeDto.java");
		map.put("service/dto/ResourceRoleTreeDto.ftl", "/dto/ResourceRoleTreeDto.java");
		map.put("service/dto/ResourceRoleTreeParentDto.ftl", "/dto/ResourceRoleTreeParentDto.java");
		map.put("service/dto/ResourceTreeParentDto.ftl", "/dto/ResourceTreeParentDto.java");
		map.put("service/dto/sys/LoginDto.ftl", "/dto/sys/LoginDto.java");
		map.put("service/dto/sys/UserDto.ftl", "/dto/sys/UserDto.java");
		//entity
		map.put("service/entity/business/BusinessDatascopeExample.ftl", "/entity/business/BusinessDatascopeExample.java");
		map.put("service/entity/sys/SysDepartment.ftl", "/entity/sys/SysDepartment.java");
		map.put("service/entity/sys/SysRequestLog.ftl", "/entity/sys/SysRequestLog.java");
		map.put("service/entity/sys/SysResource.ftl", "/entity/sys/SysResource.java");
		map.put("service/entity/sys/SysRole.ftl", "/entity/sys/SysRole.java");
		map.put("service/entity/sys/SysRoleResource.ftl", "/entity/sys/SysRoleResource.java");
		map.put("service/entity/sys/SysUser.ftl", "/entity/sys/SysUser.java");
		map.put("service/entity/sys/SysUserDepartment.ftl", "/entity/sys/SysUserDepartment.java");
		map.put("service/entity/sys/SysUserRole.ftl", "/entity/sys/SysUserRole.java");
		//mapper
		map.put("service/mapper/business/BusinessDatascopeExampleMapper.ftl", "/mapper/business/BusinessDatascopeExampleMapper.java");
		map.put("service/mapper/sys/SysDepartmentMapper.ftl", "/mapper/sys/SysDepartmentMapper.java");
		map.put("service/mapper/sys/SysRequestLogMapper.ftl", "/mapper/sys/SysRequestLogMapper.java");
		map.put("service/mapper/sys/SysResourceMapper.ftl", "/mapper/sys/SysResourceMapper.java");
		map.put("service/mapper/sys/SysRoleMapper.ftl", "/mapper/sys/SysRoleMapper.java");
		map.put("service/mapper/sys/SysRoleResourceMapper.ftl", "/mapper/sys/SysRoleResourceMapper.java");
		map.put("service/mapper/sys/SysUserDepartmentMapper.ftl", "/mapper/sys/SysUserDepartmentMapper.java");
		map.put("service/mapper/sys/SysUserMapper.ftl", "/mapper/sys/SysUserMapper.java");
		map.put("service/mapper/sys/SysUserRoleMapper.ftl", "/mapper/sys/SysUserRoleMapper.java");
		//service
		map.put("service/service/business/IBusinessDatascopeExampleService.ftl", "/service/business/IBusinessDatascopeExampleService.java");
		map.put("service/service/business/impl/BusinessDatascopeExampleServiceImpl.ftl", "/service/business/impl/BusinessDatascopeExampleServiceImpl.java");
		map.put("service/service/sys/AuthSerivce.ftl", "/service/sys/AuthSerivce.java");
		map.put("service/service/sys/ISysDepartmentService.ftl", "/service/sys/ISysDepartmentService.java");
		map.put("service/service/sys/ISysRequestLogService.ftl", "/service/sys/ISysRequestLogService.java");
		map.put("service/service/sys/ISysResourceService.ftl", "/service/sys/ISysResourceService.java");
		map.put("service/service/sys/ISysRoleResourceService.ftl", "/service/sys/ISysRoleResourceService.java");
		map.put("service/service/sys/ISysRoleService.ftl", "/service/sys/ISysRoleService.java");
		map.put("service/service/sys/ISysUserDepartmentService.ftl", "/service/sys/ISysUserDepartmentService.java");
		map.put("service/service/sys/ISysUserRoleService.ftl", "/service/sys/ISysUserRoleService.java");
		map.put("service/service/sys/ISysUserService.ftl", "/service/sys/ISysUserService.java");
		//service.impl
		map.put("service/service/sys/impl/AuthServiceImpl.ftl", "/service/sys/impl/AuthServiceImpl.java");
		map.put("service/service/sys/impl/SysDepartmentServiceImpl.ftl", "/service/sys/impl/SysDepartmentServiceImpl.java");
		map.put("service/service/sys/impl/SysRequestLogServiceImpl.ftl", "/service/sys/impl/SysRequestLogServiceImpl.java");
		map.put("service/service/sys/impl/SysResourceServiceImpl.ftl", "/service/sys/impl/SysResourceServiceImpl.java");
		map.put("service/service/sys/impl/SysRoleResourceServiceImpl.ftl", "/service/sys/impl/SysRoleResourceServiceImpl.java");
		map.put("service/service/sys/impl/SysRoleServiceImpl.ftl", "/service/sys/impl/SysRoleServiceImpl.java");
		map.put("service/service/sys/impl/SysUserDepartmentServiceImpl.ftl", "/service/sys/impl/SysUserDepartmentServiceImpl.java");
		map.put("service/service/sys/impl/SysUserRoleServiceImpl.ftl", "/service/sys/impl/SysUserRoleServiceImpl.java");
		map.put("service/service/sys/impl/SysUserServiceImpl.ftl", "/service/sys/impl/SysUserServiceImpl.java");
		return map;
	}
	
	private static Map<String,String> getXmlList() {
		Map<String,String> map = new LinkedHashMap<String,String>();
		//mapper.xml
		map.put("xml/business/BusinessDatascopeExampleMapper.ftl", "/business/BusinessDatascopeExampleMapper.xml");
		map.put("xml/sys/SysDepartmentMapper.ftl", "/sys/SysDepartmentMapper.xml");
		map.put("xml/sys/SysRequestLogMapper.ftl", "/sys/SysRequestLogMapper.xml");
		map.put("xml/sys/SysResourceMapper.ftl", "/sys/SysResourceMapper.xml");
		map.put("xml/sys/SysRoleMapper.ftl", "/sys/SysRoleMapper.xml");
		map.put("xml/sys/SysRoleResourceMapper.ftl", "/sys/SysRoleResourceMapper.xml");
		map.put("xml/sys/SysUserDepartmentMapper.ftl", "/sys/SysUserDepartmentMapper.xml");
		map.put("xml/sys/SysUserMapper.ftl", "/sys/SysUserMapper.xml");
		map.put("xml/sys/SysUserRoleMapper.ftl", "/sys/SysUserRoleMapper.xml");
		return map;
	}
	
	private static Map<String,String> getConfigList() {
		Map<String,String> map = new LinkedHashMap<String,String>();
		//mapper.xml
		map.put("web/config/application.ftl", "/config/application.yml");
		map.put("web/config/application-dev.ftl", "/config/application-dev.yml");
		map.put("web/config/redisson.ftl", "/config/redisson.yml");
		map.put("web/config/logback.ftl", "/logback-spring.xml");
		return map;
	}
	
	
	private static Map<String,String> getCommonList() {
		Map<String,String> map = new LinkedHashMap<String,String>();
		//annotation
		map.put("common/annotation/DataScope.ftl", "/annotation/DataScope.java");
		map.put("common/annotation/Permission.ftl", "/annotation/Permission.java");
		map.put("common/annotation/RequestLog.ftl", "/annotation/RequestLog.java");
		//configuration
		map.put("common/configuration/JacksonConfig.ftl", "/configuration/JacksonConfig.java");
		map.put("common/configuration/MybatisPlusAutoConfiguration.ftl", "/configuration/MybatisPlusAutoConfiguration.java");
		map.put("common/configuration/MyWebMvcConfiguration.ftl", "/configuration/MyWebMvcConfiguration.java");
		map.put("common/configuration/RedisConfig.ftl", "/configuration/RedisConfig.java");
		//constant
		map.put("common/constant/Constant.ftl", "/constant/Constant.java");
		//controller
		map.put("common/controller/BaseController.ftl", "/controller/BaseController.java");
		//entity
		map.put("common/entity/base/CommonEntity.ftl", "/entity/base/CommonEntity.java");
		map.put("common/entity/base/CommonIdEntity.ftl", "/entity/base/CommonIdEntity.java");
		map.put("common/entity/common/SaveRequestLog.ftl", "/entity/common/SaveRequestLog.java");
		map.put("common/entity/page/PageInfo.ftl", "/entity/page/PageInfo.java");
		map.put("common/entity/page/PageReq.ftl", "/entity/page/PageReq.java");
		map.put("common/entity/req/CommonReq.ftl", "/entity/req/CommonReq.java");
		map.put("common/entity/resp/BaseRsp.ftl", "/entity/resp/BaseRsp.java");
		map.put("common/entity/resp/CommonRsp.ftl", "/entity/resp/CommonRsp.java");
		map.put("common/entity/resp/Result.ftl", "/entity/resp/Result.java");
		//enums
		map.put("common/enums/ExceptionEnum.ftl", "/enums/ExceptionEnum.java");
		//exception
		map.put("common/exception/BusinessException.ftl", "/exception/BusinessException.java");
		//strategy
		map.put("common/strategy/MessageStrategy.ftl", "/strategy/MessageStrategy.java");
		map.put("common/strategy/RedissonLocker.ftl", "/strategy/RedissonLocker.java");
		//utils
		map.put("common/utils/AssertUtil.ftl", "/utils/AssertUtil.java");
		map.put("common/utils/ChineseCharToEn.ftl", "/utils/ChineseCharToEn.java");
		map.put("common/utils/CommonUtils.ftl", "/utils/CommonUtils.java");
		map.put("common/utils/ExcelClient.ftl", "/utils/ExcelClient.java");
		map.put("common/utils/ImageVerificationCode.ftl", "/utils/ImageVerificationCode.java");
		map.put("common/utils/JacksonUtil.ftl", "/utils/JacksonUtil.java");
		map.put("common/utils/RedisLockUtil.ftl", "/utils/RedisLockUtil.java");
		map.put("common/utils/RedisUtil.ftl", "/utils/RedisUtil.java");
		map.put("common/utils/TreeListUtil.ftl", "/utils/TreeListUtil.java");
		return map;
	}
	
	private static Map<String,String> getWebList() {
		Map<String,String> map = new LinkedHashMap<String,String>();
		//aspect
		map.put("web/aspect/DataScopeAspect.ftl", "/aspect/DataScopeAspect.java");
		map.put("web/aspect/PermissionAspect.ftl", "/aspect/PermissionAspect.java");
		map.put("web/aspect/RequestLogAspect.ftl", "/aspect/RequestLogAspect.java");
		//constant
		map.put("web/constant/ScanPackageConstant.ftl", "/constant/ScanPackageConstant.java");
		//controller
		map.put("web/controller/business/BusinessDatascopeExampleController.ftl", "/controller/business/BusinessDatascopeExampleController.java");
		map.put("web/controller/other/ExampleController.ftl", "/controller/other/ExampleController.java");
		map.put("web/controller/sys/SysAuthController.ftl", "/controller/sys/SysAuthController.java");
		map.put("web/controller/sys/SysDepartmentController.ftl", "/controller/sys/SysDepartmentController.java");
		map.put("web/controller/sys/SysRequestLogController.ftl", "/controller/sys/SysRequestLogController.java");
		map.put("web/controller/sys/SysResourceController.ftl", "/controller/sys/SysResourceController.java");
		map.put("web/controller/sys/SysRoleController.ftl", "/controller/sys/SysRoleController.java");
		map.put("web/controller/sys/SysUserController.ftl", "/controller/sys/SysUserController.java");
		//handler
		map.put("web/handler/GlobalExceptionHandler.ftl", "/handler/GlobalExceptionHandler.java");
		map.put("web/handler/MyMetaObjectHandler.ftl", "/handler/MyMetaObjectHandler.java");
		//message
		map.put("web/message/kafka/consumer/KafkaConsumer.ftl", "/message/kafka/consumer/KafkaConsumer.java");
		map.put("web/message/kafka/producer/KafkaProducer.ftl", "/message/kafka/producer/KafkaProducer.java");
		map.put("web/message/kafka/topic/TopicConstant.ftl", "/message/kafka/topic/TopicConstant.java");
		//schedule
		map.put("web/schedule/config/XxlJobConfig.ftl", "/schedule/config/XxlJobConfig.java");
		map.put("web/schedule/MySchedule.ftl", "/schedule/MySchedule.java");
		//swagger
		map.put("web/swagger/SwaggerUiAutoConfiguration.ftl", "/swagger/SwaggerUiAutoConfiguration.java");
		//utils
		map.put("web/utils/RequestHolder.ftl", "/utils/RequestHolder.java");
		//application
		map.put("web/WebApplication.ftl", "/WebApplication.java");
		return map;
	}
}
